# OutGuess 0.1 Makefile (c) 1999 Niels Provos

srcdir		= @srcdir@
VPATH		= @srcdir@

install_prefix	=
prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@
mandir		= @mandir@/man1

CC		= @CC@
CFLAGS		= @CFLAGS@ $(JPEGINCS)
LDFLAGS		= @LDFLAGS@
LIBS		= $(JPEGLIBS) -lm

INSTALL		= @INSTALL@
INSTALL_PROG	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@

JPEGDIR		= ./jpeg-6b-steg
JPEGINCS	= -I$(JPEGDIR)
JPEGLIBS	= -L$(JPEGDIR) -ljpeg
JPEGDEP		= $(JPEGDIR)/libjpeg.a

# Use fourier functions
# CFLAGS	+= -DFOURIER -I/usr/local/include
# LIBS		+= -L/usr/local/lib -lrfftw -lfftw

MISSING		= @LIBMISSING@
OBJ		= outguess.o golay.o arc.o pnm.o jpg.o iterator.o

all: outguess extract histogram

$(MISSING):
	$(CC) $(CFLAGS) $(INCS) -c @MISSINGOBJ@

outguess: $(JPEGDEP) $(OBJ) $(MISSING)
	$(CC) $(CFLAGS) $(INCS) -o $@ $(OBJ) $(MISSING) $(LDFLAGS) $(LIBS)

histogram: histogram.o $(MISSING)
	$(CC) $(CFLAGS) $(INCS) -o $@ histogram.o $(MISSING)

extract: outguess
	ln -sf outguess $@

$(JPEGDEP):
	cd $(JPEGDIR); $(MAKE) libjpeg.a

install: all
	$(INSTALL_PROG) -m 755 outguess $(install_prefix)$(bindir)
	$(INSTALL_DATA) outguess.1 $(install_prefix)$(mandir)

clean:
	rm -f outguess extract histogram histogram.o *~ $(OBJ) $(MISSING)

distclean: clean
	cd $(JPEGDIR); $(MAKE) $@
	rm -f Makefile config.h config.status config.cache config.log
